Learn R Programming

Compositional (version 3.7)

Cross validation for the alpha-k-NN regression for compositional response data: Cross validation for the \(\alpha\)-k-NN regression for compositional response data

Description

Cross validation for the \(\alpha\)-k-NN regression for compositional response data.

Usage

aknnreg.tune(y, x, a = seq(0.1, 1, by = 0.1), k = 2:10,
apostasi = "euclidean", nfolds = 10, folds = NULL, seed = FALSE)

Arguments

y

The response variable, a numerical vector.

x

A matrix with the available compositional data. Zeros are allowed.

a

A vector with a grid of values of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If \(\alpha=0\) the isometric log-ratio transformation is applied.

k

The number of nearest neighbours to consider. It can be a single number or a vector.

apostasi

The type of distance to use, either "euclidean" or "manhattan".

nfolds

The number of folds. Set to 10 by default.

folds

If you have the list with the folds supply it here. You can also leave it NULL and it will create folds.

seed

If seed is TRUE the results will always be the same.

Value

A list including:

kl

The Kullback-Leibler divergence for all combinations of \(\alpha\) and k.

js

The Jensen-Shannon divergence for all combinations of \(\alpha\) and k.

klmin

The minimum Kullback-Leibler divergence.

jsmin

The minimum Jensen-Shannon divergence.

kl.alpha

The optimim \(\alpha\) that leads to the minimum Kullback-Leibler divergence.

kl.k

The optimim k that leads to the minimum Kullback-Leibler divergence.

js.alpha

The optimim \(\alpha\) that leads to the minimum Jensen-Shannon divergence.

js.k

The optimim k that leads to the minimum Jensen-Shannon divergence.

runtime

The runtime of the cross-validation procedure.

Details

A k-fold cross validation for the \(\alpha\)-k-NN regression for compositional response data is performed.

References

Michail Tsagris, Abdulaziz Alenazi and Connie Stewart (2020). The alpha-k-NN- regression for compositional data. https://arxiv.org/pdf/2002.05137.pdf

See Also

alfa.rda, alfa.fda, rda.tune

Examples

Run this code
# NOT RUN {
y <- as.matrix( iris[, 1:3] )
y <- y / rowSums(y)
x <- iris[, 4]
mod <- aknnreg.tune(y, x, a = c(0.4, 0.6), k = 2:4, nfolds = 5)
# }

Run the code above in your browser using DataLab